﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using WmsApp.WmsService;

namespace WmsApp.Service
{
    public class UnitService : IEntityService<Unit, UnitService>
    {

        #region IEntityService<Customer> Members

        public List<Unit> GetEntityList()
        {
            var sc = Factory.WmsServiceFactory.GetServiceClient();
            List<Unit> list = sc.GetUnits();
            foreach (var unit in list)
            {
                unit.BindPropertyChanged();
            }
            return list;
        }

        public List<Unit> GetEntityList(string condition)
        {
            throw new NotImplementedException();
        }

        public void SaveEntityList(List<Unit> list)
        {
            var sc = Factory.WmsServiceFactory.GetServiceClient();
            sc.SaveUnits(list);
            foreach (var c in list)
            {
                c.WcfEntityState = EntityState.Unchanged;
            }
        }

        public Unit GetEntity(string key)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
